using System;
using System.Collections.Generic;
using System.Text;
using Wrath.Xml;
using Wrath.RuleForge.Interfaces;
using System.ComponentModel;

namespace Wrath.RuleForge.Property
{
    public class PortraitSetWrapper : IPropertyWrapper<Element>
    {
        private bool hasChanged;
        private Element element;

        private Wrath.Xml.Attribute nameAttribute;
        private Element baseElement;
        private Element maskElement;

        [Category("Portrait Set")]
        [Description("The name of the portrait set.")]
        public string Name { get { return nameAttribute.Value; } set { nameAttribute.Value = value; } }

        [Category("Portrait Set")]
        [Description("The base of the portrait set.")]
        public string Base { get { return baseElement.Value; } set { baseElement.Value = value; } }

        [Category("Portrait Set")]
        [Description("The mask of the portrait set.")]
        public string Mask { get { return maskElement.Value; } set { maskElement.Value = value; } }

        public PortraitSetWrapper(Element element)
        {
            hasChanged = false;
            this.element = element;

            nameAttribute = element.FindAttribute("name");
            baseElement = element.FindFirstElement("base", false);
            maskElement = element.FindFirstElement("mask", false);
        }

        #region IPropertyWrapper<Element> Members

        [Browsable(false)]
        public bool HasChanged
        {
            get
            {
                return hasChanged;
            }
            set
            {
                hasChanged = value;
            }
        }

        [Browsable(false)]
        public Element Data
        {
            get { return element; }
        }

        #endregion
    }
}
